home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Leser 15
/
Amiga Plus Leser CD 15.iso
/
Online
/
newscoaster
/
Rexx
/
after_fetchPL.rexx
next >
Wrap
OS/2 REXX Batch file
|
2002-03-12
|
3KB
|
89 lines
/* ISO-8859-2 to AmigaPL conversion for NewsCoaster */
/* by Grzegorz Kraszewski (Krashan^BlaBla) <krashan@amiga.org.pl> */
/* $VER: NewsCoasterPL 1.0 (30.4.2000) BLABLA PRODUCT */
OPTIONS RESULTS
ADDRESS "NEWSCOASTER"
IF ~Show("L","rexxsupport.library") THEN CALL AddLib("rexxsupport.library", 0, -30)
iso88592 = "±æê³óñ¶¼¿¡ÆÊ£ÑÓ¦¬¯"
amigapl = "âêëîóïôúûÂÊËÎÓÏÔÚÛ"
encoding = "8bit"
SetFolderByName "pl.comp.sys.amiga"
FolderInfo
fldinfo = RESULT
PARSE VAR fldinfo numer " "
folderpath = "NewsCoasterData:Folder_" || numer
lista = ShowDir(folderpath,"F",":")
DO WHILE lista ~= ""
PARSE VAR lista filename ":" lista
IF Upper(Left(filename,5)) = "NEWS_" THEN
DO
filename = folderpath || "/" || filename
newname = filename || ".BB"
IF Open(file1,filename,"R") THEN
DO
IF Open(file2,newname,"W") THEN
DO
DO WHILE ~Eof(file1)
line = ReadLn(file1)
IF Upper(Left(line,27)) = "CONTENT-TRANSFER-ENCODING: " THEN
DO
PARSE VAR line " " encoding
encoding = Strip(encoding,"T",D2C(13))
END
SELECT
WHEN encoding == "8bit" THEN DO
line = Translate(line,amigapl,iso88592)
END
WHEN encoding == "quoted-printable" THEN DO
CALL QPTranslate(line)
END
OTHERWISE
END
WriteLn(file2,line)
END
Close(file2)
END
Close(file1)
Delete(filename)
Rename(newname,filename)
END
END
Say (encoding || "!")
END
EXIT
QPTranslate:
actual = 1
DO FOREVER
actual = Pos("=",line,actual)
IF actual = 0 THEN RETURN
actual = actual + 1
code = Substr(line,actual,2)
SELECT
WHEN code = "B1" THEN code = "E2" /* â */
WHEN code = "A1" THEN code = "C2" /* Â */
WHEN code = "E6" THEN code = "EA" /* ê */
WHEN code = "C6" THEN code = "CA" /* Ê */
WHEN code = "EA" THEN code = "EB" /* ë */
WHEN code = "CA" THEN code = "CB" /* Ë */
WHEN code = "B3" THEN code = "EE" /* î */
WHEN code = "A3" THEN code = "CE" /* Î */
WHEN code = "F1" THEN code = "EF" /* ï */
WHEN code = "D1" THEN code = "CF" /* Ï */
WHEN code = "B6" THEN code = "F4" /* ô */
WHEN code = "A6" THEN code = "D4" /* Ô */
WHEN code = "BC" THEN code = "FA" /* ú */
WHEN code = "AC" THEN code = "DA" /* Ú */
WHEN code = "BF" THEN code = "FB" /* û */
WHEN code = "AF" THEN code = "DB" /* Û */
OTHERWISE
END
IF code ~= "" THEN line = Overlay(code,line,actual)
END
RETURN